package prolog.fluents

import scala.collections.jcl.ArrayList

import prolog.terms.Prog
import prolog.terms.Sink
import prolog.terms.Term

/**
  Builds  Fluents from Java
  Streams  */


class TermCollector(buffer:ArrayList,p:Prog) extends Sink

		{
		protected ArrayList bufferss
		private Prog p
		
		public TermCollector(p:prog){
				super(p)
				this.p=p
				this.buffer=new ArrayList()
				}
		def putElement(T:Term):int={
			buffer.add(T)
			} 
		
		def stop():Unit={buffer=null
		}
		
		def collect():Term={ 
				new ScalaSource(buffer,p)
				   }

}	